Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uefi: Add safe protocol wrapper for EFI_ATA_PASS_THRU_PROTOCOL #1595

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seijikun
Copy link
Contributor

@seijikun seijikun commented Mar 27, 2025

Update Latest API discussions


Implemented a safe API wrapper for EFI_ATA_PASS_THRU_PROTOCOL [1d3de7f0-0807-424f-aa69-11a54e19a46f].
Added an integration-test for it.

This contains a copy of the AlignedBuffer commit from #1589.

This uses the iterator/mutable design I suggested here: #1589 (comment) where the iter method only captures the protocol (AtaPassThru) immutably, but requires you to use the produced element (AtaDevice) in a mutable way for meaningful methods like execute_command.

This closes #244

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

@seijikun seijikun force-pushed the mr-atapt branch 14 times, most recently from 5d20e04 to 17ff660 Compare March 28, 2025 01:19
Copy link
Member

@phip1611 phip1611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! Left a few remarks

@seijikun seijikun force-pushed the mr-atapt branch 2 times, most recently from 2ccfb33 to 6a82a32 Compare March 28, 2025 10:43
@nicholasbishop nicholasbishop mentioned this pull request Apr 1, 2025
2 tasks
@phip1611 phip1611 mentioned this pull request Apr 6, 2025
12 tasks
@seijikun seijikun force-pushed the mr-atapt branch 2 times, most recently from 4e64767 to 9a64ab4 Compare April 8, 2025 09:55
@phip1611 phip1611 changed the title Add safe protocol wrapper for EFI_ATA_PASS_THRU_PROTOCOL uefi: Add safe protocol wrapper for EFI_ATA_PASS_THRU_PROTOCOL Apr 8, 2025
@seijikun seijikun force-pushed the mr-atapt branch 2 times, most recently from 8ab0d94 to 1e5d815 Compare April 8, 2025 12:03
@@ -489,6 +489,18 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> {
cmd.arg("-device"); // attach disk to SCSI controller
cmd.arg("scsi-hd,drive=scsidisk0,vendor=uefi-rs,product=ExtScsiPassThru");

if arch == UefiArch::IA32 || arch == UefiArch::X86_64 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens on AARCH64? Does QEMU only support the ATA controller on x86?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting it to work is difficult because the default hardware configuration between x86 and arm is quite different. And since (at least afaik) I can't run it locally, I would need to push 1000 times to get it working. I'll try again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qemu seems to support having a SATA controller with aarch64.
But the UEFI firmware does not produce an AtaPassThru instance for the controller. So it seems that EDK2 is at fault. I'll document it.

Copy link
Member

@phip1611 phip1611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're almost there!

@seijikun seijikun force-pushed the mr-atapt branch 5 times, most recently from 530521a to dd50f86 Compare April 10, 2025 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementing pass-through protocols
2 participants